<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户奖品列表</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <#include "/view/admin/head.html"/>
    <script type="text/javascript" src="${base}/jstool/bootstrap-switch/bootstrap-switch.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-switch/bootstrap-switch.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-select/js/bootstrap-select.min.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-select/lang/defaults-zh_CN.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-select/css/bootstrap-select.min.css" />    
    <style type="text/css">
        .table-class{
            width:80%;
            text-align: center;
            border:1px solid #afd9ee;
            margin:0 auto;
            margin-top: 50px;
        }
        .list-path{
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;

        }
        table th{
            text-align: center;
        }
        table thead tr {
            background-color: #9acfea;
        }
        .table-query{
            /*height: 40px;*/
            /*width:80px;*/
            /*text-align: center;*/
            white-space:nowrap;

        }
    </style>
    <script type="text/javascript">
        function query(dm){
        	//用户昵称
            var nickname = $('#nickname').val();
        	//用户手机号码
            var telephone = $('#telephone').val();
        	//奖品名称
            var thingName = $('#thingName').val();
        	//优惠活动
        	var rouletteId = $("#rouletteId").val();
        	//中奖开始时间
        	var startTime = $("#startTime").val();
        	//中奖结束时间
        	var endTime =$("#endTime").val();
        	//服务区名称
        	var serviceName = $("#serviceName").val();
        	//核销电话
        	var countTel =$("#countTel").val();
        	//奖品状态
        	var status = $("#status").val();
        	//核销人姓名
        	var countName = $("#countName").val();
            location.href='${base}/awarduse/czjawarduseList.do?nickname='+nickname+'&telephone='+telephone+'&thingName='+thingName
            		+'&rouletteId='+rouletteId+'&startTime='+startTime+'&endTime='+endTime
            		+'&serviceName='+serviceName+'&countTel='+countTel+'&status='+status+'&countName='+countName;
        }
    </script>
</head>
<body>

<#include "/view/admin/listnav.html"/> 
      

<div class="table-class">
    <div class="panel panel-default" style="margin: 10px 50px 10px;">
     <div class="panel-body">
        <form class="bs-example bs-example-form" role="form">


            <div class="input-group">
                <span class="input-group-addon">用户昵称</span>
                <input type="text" id="nickname" class="form-control" style="width:200px;" value="${nickname!}" placeholder="请输入用户昵称">
                                     
                <span class="input-group-addon">手机号码</span>
                <input type="text" id="telephone" class="form-control" style="width:200px;" value="${telephone!}" placeholder="请输入用户手机号码">
            </div>
                <span class="bank-label">&nbsp;</span>

            <div class="input-group">
                <span class="input-group-addon">奖品名称</span>
                <input type="text" id="thingName" class="form-control" style="width:202px;" value="${thingName!}" placeholder="请输入奖品名称">
          
                <span class="input-group-addon">优惠活动</span>
                <select  id="rouletteId" class="form-control" style="width:202px;" >
                  <option value="">请选择优惠活动</option>
                  <#list czjroulettes as c>
                     <option value="${c.rouletteId}" <#if rouletteId?? &&  rouletteId == c.rouletteId >selected="selected" </#if> >${c.actname}</option>
                  </#list>
                </select>
            </div>
                <span class="bank-label">&nbsp;</span>                
            <div class="input-group">
                <span class="input-group-addon">中奖开始时间</span>
                <input type="text" id="startTime" class="form-control" style="width:175px;" value="${startTime!}" placeholder="请输入中奖开始时间">
                                     
                <span class="input-group-addon">中奖结束时间</span>
                <input type="text" id="endTime" class="form-control" style="width:175px;" value="${endTime!}" placeholder="请输入中奖结束时间">
            </div>
                <span class="bank-label">&nbsp;</span> 
            <div class="input-group">
                <span class="input-group-addon">服务区名称</span>
                <input type="text" id="serviceName" class="form-control" style="width:190px;" value="${serviceName!}" placeholder="请输入服务区名称">
          
                <span class="input-group-addon">核销人电话</span>
                <input type="text" id="countTel" class="form-control" style="width:190px;" value="${countTel!}" placeholder="请输入核销电话">                
            </div>
                <span class="bank-label">&nbsp;</span> 
            <div class="input-group">
                <span class="input-group-addon">奖品状态</span>
                <select  id="status" class="form-control" style="width:202px;" >
                   <option value="">请选择</option>
                   <option value="11" <#if status?? && status=="11"> selected="selected" </#if> >已领取</option>
                   <option value="12" <#if status?? && status=="12"> selected="selected" </#if> >未领取</option>
                   <option value="4" <#if status??  && status=="4"> selected="selected" </#if> >未使用</option>
                   <option value="5" <#if status??  && status=="5"> selected="selected" </#if> >已使用</option>
                </select>
                <span class="input-group-addon">核销人姓名</span>
                <input type="text" id="countName" class="form-control" style="width:190px;" value="${countName!}" placeholder="请输入核销人姓名">                                    
            </div>
                <span class="bank-label">&nbsp;</span>                                                  

            <div class="input-group" style="text-align: right;">
                <a class="btn btn-info"  href="javascript:query(this)"><span class="glyphicon glyphicon-search"></span> 查找</a>

            </div>
        </form>
     </div>
    </div>
      <#if  message??  >
        <div class="alert alert-error" style="background-color: write;color: red;">           
           <font size="5"><strong>${message!}</strong></font>
        </div>
     </#if>
      <hr/>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
	 <th>用户昵称</th>  	 
   	 <th>手机号码</th>
   	 <th>奖品名称</th>
   	 <th>中奖时间</th>
   	 <th>奖品状态</th>
     <th width="200">操作选项</th>
        </tr>
        </thead>
        <tbody>
        
        <tr>
            <td colspan="9" style="text-align: left;color: red; ">总数：${pagination.totalCount}
            </td>
        </tr> 
               
        <#list pagination.list as c>
            <tr>
 <td>${c.nickname!?html}</td>
  <td>${c.telephone!?html}</td>
 <td>${c.thingName!?html}</td>
 
 <td>
 
 <#if c.createtime ??>
 ${c.createtime!?string("yyyy-MM-dd HH:mm:ss")}
 </#if>
 
 </td>
 <td>    
             <#if c.status?? && c.status ==11 >已领取</#if> 
             <#if c.status?? && c.status ==12 >未领取</#if>
             <#if c.status?? && c.status ==4 >未使用</#if>  
             <#if c.status?? && c.status ==5 >已使用</#if> 
 </td>
 
 


	<td align="center">	
<@shiro.hasPermission name="10.3.1">			
   <a href="czjawarduseEdit.do?awarduseId=${c.awarduseId}&shopId=${c.shopId!}actionEdit=true" class="btn btn-primary">详情</a> 
</@shiro.hasPermission> 
<@shiro.hasPermission name="10.3.2">  
   <a href="czjawarduseDelete.do?ids=${c.awarduseId}" onclick="if(!confirm('您确定删除吗？')) {return false;}" class="btn btn-primary">删除</a>   
 </@shiro.hasPermission>  
   </td>
            </tr>


        </#list>
        <#if 0==pagination.totalCount>
            <tr>
                <td colspan="7" style="color: red"> 没有相关数据 </td>
            </tr>
        </#if>




        </tbody>
    </table>
    <#include "/view/admin/pagination.html"/>

    <div style="text-align:left;  padding:10px;">
		<!-- <input type="button" class="btn btn-info" value="添加 奖品 " onclick="javascript:location.href='czjawarduseAdd.do?shopId=${shopId!}'"/> -->
   </div>
   <br>

</div>
<script>
		function setPage(pageNo,pageSize){
		    var lianjie=document.location.href;
		    var lianjie = lianjie.substr(0,lianjie.indexOf('?'))
		    var href = lianjie+"?";
		    href+=queryCondition();
		    href+="&pageNo="+pageNo;
		    href+="&pageSize="+pageSize;
		    location.href=href;
		}
		
		function queryCondition(){
			//用户昵称
            var nickname = $('#nickname').val();
        	//用户手机号码
            var telephone = $('#telephone').val();
        	//奖品名称
            var thingName = $('#thingName').val();
        	//优惠活动
        	var rouletteId = $("#rouletteId").val();
        	//中奖开始时间
        	var startTime = $("#startTime").val();
        	//中奖结束时间
        	var endTime =$("#endTime").val();
        	//服务区名称
        	var serviceName = $("#serviceName").val();
        	//核销电话
        	var countTel =$("#countTel").val();
        	//奖品状态
        	var status = $("#status").val();
        	//核销人姓名
        	var countName = $("#countName").val();
        	var str = '';
        	str+='nickname='+nickname+'&telephone='+telephone+'&thingName='+thingName
            		+'&rouletteId='+rouletteId+'&startTime='+startTime+'&endTime='+endTime
            		+'&serviceName='+serviceName+'&countTel='+countTel+'&status='+status+'&countName='+countName;
        	return str;
			
			
			
			
		}

    $(function () {
        $('[data-toggle="popover"]').each(function () {
            var element = $(this);
            var id = element.attr('id');
            var count = '0';
            var key = $(this).parent().find('input[class=userinfoId]').attr('id');
            var userinfoId=$(this).parent().find('input[class=userinfoId]').val();
            var ticket=$(this).parent().find('input[class=ticket]').val();
            element.popover({
                trigger: 'manual',
                placement: 'bottom', //top, bottom, left or right
                title: '修改票数',

                html: 'true',
                content: ContentMethod(key,userinfoId,ticket),
            }).on("click", function () {
                var _this = this;
                $(this).popover("show");
               /* $(this).siblings(".popover").on("mouseleave", function () {
                    $(_this).popover('hide');
                });*/
            })/*.on("mouseleave", function () {

                var _this = this;
                setTimeout(function () {
                    if (!$(".popover:hover").length) {
                        $(_this).popover("hide")
                    }
                }, 100);
            })*/;
        });
    });
    function ContentMethod(key,userinfoId,ticket) {
        return '<form action="${base}/vote/savevotenum.do" method="POST"><table class="table table-bordered"><tr><td><input type="hidden"  name="id" value="'+userinfoId+'"/><input type="text" placeholder="票数" name="voteNum" value="'+ticket+'"/> </td></tr><tr><td><button type="submit" class="btn btn-success" >修改</button>&nbsp;&nbsp;<button type="button" class="btn btn-danger" onclick="closePPv('+key+')">取消</button> </td></tr></table></form>';
    }
    function closePPv(key){
        $(key).siblings('a[class=ppov]').popover('hide');
    }

    $(function() {
        //初始化
	        $('#startTime').datetimepicker(
					{
						language : 'zh-CN',//显示中文
						format : "yyyy-mm-dd",
						autoclose : true,
						todayBtn : true,
						startDate : "<#if (beginTime)??></#if>",
						minuteStep : 10,
						minView: "month"
					});
	        $('#endTime').datetimepicker(
					{
						language : 'zh-CN',//显示中文
						format : "yyyy-mm-dd",
						autoclose : true,
						todayBtn : true,
						startDate : "<#if (beginTime)??></#if>",
						minuteStep : 10,
						minView: "month"
					});
    });



</script>

</body>
</html>